#Game: Vice City Stories
#Author: MicSuit
#Version: 1.0
#Category: Missions
#Date: 2022-07-24
#Description: A mission made with SCM tools. Have fun and please don't cheat. :P

0004: $3101 = 3000

001B:   $ONMISSION == 0 
0022: goto_if_false @TERMINATE_SCRIPT

:START_MISSION
0004: $ONMISSION = 1

02EE: get_offset_from_char_in_world_coords $PLAYER_CHAR offset 0.0 5.0 0.0 store_to 1@ 2@ 3@ // Get coordinates with an offset

0160: request_model 199 // Idaho
0228: load_all_models_now

0048: create_car 199 at 1@ 2@ 3@ store_to 4@ // Spawn Idaho (id = 199)

0117: dont_remove_object 4@
00C0: add_blip_for_car 4@ store_to 5@
00BC: change_blip_colour 5@ to 2

0002: goto @CHECK_CAR

:GET_BACK_CAR1
0249: remove_sphere $1833
0004: $1833 = 0
00BB: remove_blip $1525
0004: $1525 = 0
00C0: add_blip_for_car 4@ store_to 5@
00BC: change_blip_colour 5@ to 2

:GET_BACK_CAR2
0001: wait 0
0056: print 'Go back to the ~b~Idaho~w~!' time 1 flag 1
004F:   is_car_still_alive 4@
0022: goto_if_false @END_MISSION_FAILED
00A5:   has_player_been_arrested $PLAYER_CHAR
0021: goto_if_true @END_MISSION_FAILED
007C:   is_char_in_car $PLAYER_CHAR car 4@
0022: goto_if_false @GET_BACK_CAR2
00BB: remove_blip 5@
00C3: add_blip_for_coord $1 $2 $3 store_to $1525
0248: add_sphere $1 $2 $3 radius 4.0 store_to $1833
0002: goto @CHECK_SPHERE

:GET_BACK_CAR3
00C0: add_blip_for_car 4@ store_to 5@
00BC: change_blip_colour 5@ to 2

:GET_BACK_CAR4
0001: wait 0
0056: print 'Go back to the ~b~Idaho~w~!' time 1 flag 1
004F:   is_car_still_alive 4@
0022: goto_if_false @END_MISSION_FAILED
007E:   is_char_in_any_car $PLAYER_CHAR 
0022: goto_if_false @GET_BACK_CAR4
807C:   not is_char_in_car $PLAYER_CHAR car 4@
0021: goto_if_true @END_MISSION_FAILED
00A5:   has_player_been_arrested $PLAYER_CHAR
0021: goto_if_true @END_MISSION_FAILED
00BB: remove_blip 5@
0002: goto @WHILE_POLICE



:CHECK_CAR
0001: wait 0
009F:   is_char_dead $PLAYER_CHAR
0021: goto_if_true @END_MISSION_FAILED
0057: print_now 'Enter the ~b~Idaho~w~!' time 1 flag 1
004F:   is_car_still_alive 4@
0022: goto_if_false @END_MISSION_FAILED
00A5:   has_player_been_arrested $PLAYER_CHAR
0021: goto_if_true @END_MISSION_FAILED
007C:   is_char_in_car $PLAYER_CHAR car 4@
0022: goto_if_false @CHECK_CAR
00BB: remove_blip 5@

:SPAWN_BS
0005: $1 = -1824.51
0005: $2 = -716.79
0005: $3 = 15.04
00C3: add_blip_for_coord $1 $2 $3 store_to $1525
0248: add_sphere $1 $2 $3 radius 4.0 store_to $1833
0267: print_help 'Go to the ~y~marker~w~.'


:CHECK_SPHERE
0001: wait 0
009F:   is_player_dead $PLAYER_CHAR
0021: goto_if_true @END_MISSION_FAILED
004F:   is_car_still_alive 4@
0022: goto_if_false @END_MISSION_FAILED
00A5:   has_player_been_arrested $PLAYER_CHAR
0021: goto_if_true @END_MISSION_FAILED
007C:   is_char_in_car $PLAYER_CHAR car 4@
0022: goto_if_false @GET_BACK_CAR1
008B:   locate_player_in_car_3d $PLAYER_CHAR coord $1 $2 $3 radius 4.0 4.0 4.0 sphere 1
0022: goto_if_false @CHECK_SPHERE

:REMOVE_BS
00BB: remove_blip $1525
0004: $1525 = 0
0249: remove_sphere $1833
0004: $1833 = 0

0107: set_player_control $PLAYER_CHAR to 0 
00C8: set_fading_colour 0 0 0 
00C9: do_fade 500 fade 0

:FADING
0001: wait 0
00CA:   get_fading_status 
0022: goto_if_false @POLICE_ALERT 
0001: wait 0 
0002: goto @FADING

:POLICE_ALERT
0001: wait 1000
014C: set_car_health 4@ to 500
0098: alter_wanted_level $PLAYER_CHAR to 5
0107: set_player_control $PLAYER_CHAR to 1 
00C9: do_fade 500 fade 1
0057: print_now 'Some ~r~idiots~w~ damaged your ~b~Idaho~w~ and called the ~b~cops~w~ on you! ~n~Escape them!' time 4000 flag 1  // ~w~You need a car to be in this race!
0002: goto @WHILE_POLICE

:STARS_5
0098: alter_wanted_level $PLAYER_CHAR to 5

:WHILE_POLICE
0001: wait 0
009F:   is_player_dead $PLAYER_CHAR
0021: goto_if_true @END_MISSION_FAILED
004F:   is_car_still_alive 4@
0022: goto_if_false @END_MISSION_FAILED
00A5:   has_player_been_arrested $PLAYER_CHAR
0021: goto_if_true @END_MISSION_FAILED
007C:   is_player_in_car $PLAYER_CHAR car 4@
0022: goto_if_false @GET_BACK_CAR3
009A:   is_wanted_level_greater $PLAYER_CHAR than 0
0021: goto_if_true @WHILE_POLICE



:END_MISSION_PASSED
011D: print_with_number_big 'M_PASS' number $3101 time 2000 style 1
0094: add_score $PLAYER_CHAR value $3101 // money
022B: play_mission_passed_tune 1
0002: goto @TERMINATE_SCRIPT

:END_MISSION_FAILED
0055: print_big 'M_FAIL' time 1000 style 1  // ~Y~MISSION FAILED!
00BB: remove_blip $1525
0004: $1525 = 0
0249: remove_sphere $1833
0004: $1833 = 0
00BB: remove_blip 5@
0098: alter_wanted_level $PLAYER_CHAR to 0


:TERMINATE_SCRIPT
0004: $ONMISSION = 0
0023: terminate_this_script